package com.chengdu.third.dao;

import com.chengdu.third.pojo.Tsxx;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ITsxxDao {

    /**
     * 查找所有
     * @return
     */
    @Select("select * from tsxx")
    public List<Tsxx> find();

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from tsxx where id  = #{id}")
    public void delete(long id);

    /**
     * 根据id修改
     * @param tsxx
     */
    @Update("update tsxx set Complaint_name = #{Complaint_name},phone = #{phone},time = #{time},content = #{content},type = #{type} where id = #{id}")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    public void update(Tsxx tsxx);

    /**
     * 增加
     * @param tsxx
     */
    @Insert("insert into  tsxx(`id`,`Complaint_name`,`phone`,`time`,`content`,`type`) values(#{id},#{Complaint_name},#{phone},#{time},#{content},#{type})")
    public void add(Tsxx tsxx);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from tsxx where id = #{id}")
    public Tsxx getTsxxById(long id);
}
